import request from '../../../util/request';
import {userServer} from '../../../config/config';

/**
 * 生成对应用户名的随机验证码,120秒超时
 */
function usernameRandom({username}) {
	return request(userServer('/api/random/usernameRandom'), {
		data: {username}
	});
}

/**
 * 生成对应手机号的随机验证码,发送至手机,120秒超时
 */
function mobilePhoneRandom({mobilePhone}) {
	return request(userServer('/api/random/mobilePhoneRandom'), {
		data: {mobilePhone}
	});
}

/**
 * 生成对应邮箱的随机验证码,发送至邮箱,600秒超时
 */
function emailRandom({email}) {
	return request(userServer('/api/random/emailRandom'), {
		data: {email}
	});
}

/**
 * 验证码校验
 */
function checkRandom({identity, random}) {
	return request(userServer('/api/random/checkRandom'), {
		data: {identity, random}
	});
}

export {
	usernameRandom,
	mobilePhoneRandom,
	emailRandom,
	checkRandom,
}
